/*
 ============================================================================
 Name		: AudioPlayer.h
 Author	  : Lenka Litvova
 Version	 : 1.0
 Copyright   : Copyright belongs to Lenka Litvova
 Description : CAudioPlayer declaration
 ============================================================================
 */

#ifndef AUDIOPLAYER_H
#define AUDIOPLAYER_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <MdaAudioSamplePlayer.h> //for MMdaAudioPlayerCallback , link against: mediaclientaudio.lib

// CLASS DECLARATION

/**
 *  CAudioPlayer
 * 
 */
class CAudioPlayer : public CBase, public MMdaAudioPlayerCallback
	{
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~CAudioPlayer();

	/**
	 * Two-phased constructor.
	 */
	static CAudioPlayer* NewL();

	/**
	 * Two-phased constructor.
	 */
	static CAudioPlayer* NewLC();
	
	void PlayFile(const TDesC& aFileName);
	void PlayText(const TDesC &aText);
	void Replay();
    void Stop();

public: // from MMdaAudioToneObserver
	/**
	 * Function called when the player is ready to start playing.
	 */
	void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
	/**
	 * Function called when player has finished playing.
	 */
	void MapcPlayComplete(TInt aError);

private:

	/**
	 * Constructor for performing 1st stage construction
	 */
	CAudioPlayer();

	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL();
	
private:
	 CMdaAudioPlayerUtility* iPlayer;
     TBool iPlaying;
     TBool iPrepared;
	};

#endif // AUDIOPLAYER_H
